import base64
pd=['2','0','2','0','1','2','2','1']
basecode_en={
        '0':lambda x:base64.b16encode(x),
        '1':lambda x:base64.b32encode(x),
        '2':lambda x:base64.b64encode(x)
    }
basecode_de={
        '0':lambda x:base64.b16decode(x),
        '1':lambda x:base64.b32decode(x),
        '2':lambda x:base64.b64decode(x)
    }
message=('20190810021','sss4555555')
def decrypt(data,passwd,basedecode):
    data_e=data.encode('utf-8')
    pw=passwd.copy()
    pw.reverse()
    for i in ['2','0','2','0','1','2','2','1']:
        data_e=basecode_en[i](data_e)
    return data_e.decode('utf-8')

def encrypt(message,passwd,basecode):
    data=message[0]+'/'+message[1]
    data=data.encode('utf-8')
    for i in passwd:
        data=basecode[i](data)
    data=data.decode('utf-8')
    return data
data_en=encrypt(('20190810201','eeeee'),pd,basecode_en)
data_de=decrypt(data_en,pd,basecode_de)
print(data_de)
print(data_en)

